package com.atguigu.educms.controller;


import com.atguigu.commonutils.R;
import com.atguigu.educms.entity.CrmBanner;
import com.atguigu.educms.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-06-30
 */
@RestController
@RequestMapping("/educms/bannerfront")
public class BannerFrontController {
    @Autowired
    CrmBannerService bannerService;

    //查询所有
    @Cacheable(key = "'selectIndexList'",value = "banner") //缓存注解
    @GetMapping("getAllBanner")
    public R getAllBanner(){
        List<CrmBanner> crmBannerList =  bannerService.selectAll();

        return R.ok().data("list",crmBannerList);
    }
}

